package com.tbit.uqbike.client.constant;

import org.openxmlformats.schemas.drawingml.x2006.main.STAdjAngle;

import java.util.Objects;

/**
 * 发票信息常量
 *
 * @Author:BUGTian
 * @DATE: 2023/8/31
 */
public class InvoiceRecordConstant {
    /**
     * 发票订单类型:骑行订单
     */
    public static final int ORDER_TYPE_RIDE = 1;
    /**
     * 发票订单类型:套餐订单
     */
    public static final int ORDER_TYPE_CARD = 2;
    /**
     * 开票状态:未开票
     */
    public static final Integer STATUS_NOT = -1;
    /**
     * 开票状态:已申请,待开票
     */
    public static final Integer STATUS_APPLY = 0;
    /**
     * 开票状态:已开票
     */
    public static final Integer STATUS_SUCCESS = 1;
    /**
     * 开票状态:已驳回
     */
    public static final Integer STATUS_REJECT = 2;
    /**
     * 开票状态:重开待审核
     */
    public static final Integer STATUS_REOPEN = 3;
    /**
     * 开票状态:已废弃
     */
    public static final Integer STATUS_abandon = 4;
    /**
     * 开票状态:重开后待审核新票
     */
    public static final Integer STATUS_REOPEN_NEW = 5;
    /**
     * 开票失败
     * */
    public static final Integer STATUS_FAIL = 6;
    /**
     * 非重开发票
     */
    public static final Integer NOT_IS_REOPEN = 0;
    /**
     * 是重开发票
     */
    public static final Integer IS_REOPEN = 1;





    /**
     * 自动开票
     * */
    public static final Integer INVOICE_OPEN_TYPE_AUTO_INVOICE = 0;

    /**
     * 手动开票
     * */
    public static final Integer INVOICE_OPEN_TYPE_HAND_INVOICE = 1;


    /**
     * 发票抬头类型----单位
     * */
    public static final Integer INVOICE_TITLE_TYPE_COMPANY = 1;
    /**
     * 发票抬头类型----个人
     * */
    public static final Integer INVOICE_TITLE_TYPE_PERSON = 2;
    /**自动开票税率*/
    public static final double TAX_RATE = 0.01;
    /**
     * 自动开票---开票业务ID
     * */
    public static final String INVOICE_API_INVOICING_SERVICE_ID = "FPKJ";
    public static final String INVOICE_API_INVOICING_URI = "/invoiceEx/zpy/electric/invoice/issued";
    /**
     * 自动开票---红冲申请业务ID
     * */
    public static final String INVOICE_API_RED_CHONG_APPLY_SERVICE_ID = "HZXXBSC";
    public static final String INVOICE_API_RED_CHONG_APPLY_URI = "/invoiceEx/zpy/electric/invoice/applyRedInformation";

    /**
     * 自动开票---发送邮件业务ID
     * */
    public static final String INVOICE_API_SEND_EMAIL_SERVICE_ID = "reSendMessage";
    public static final String INVOICE_API_SEND_EMAIL_URI = "/invoiceEx/zpy/electric/invoice/reSend";
    /**
     * 自动开票---企业抬头联想业务ID
     * */
    public static final String INVOICE_API_ASSOCIATE_SERVICE_ID = "TTLX";
    public static final String INVOICE_API_ASSOCIATE_URI = "/invoiceEx/zpy/electric/invoice/enterpriseHeader";

    /**
     * 自动开票---红冲申请确认业务ID
     * */
    public static final String INVOICE_API_RED_CHONG_CONFIRM_SERVICE_ID = "HZXXBSH";
    public static final String INVOICE_API_RED_CHONG_CONFIRM_URI = "/invoiceEx/zpy/electric/invoice/reviewRedInformation";
    /**
     * 自动开票---红冲申请撤销业务ID
     * */
    public static final String INVOICE_API_RED_CHONG_REVOKE_SERVICE_ID = "HZXXBCX";
    public static final String INVOICE_API_RED_CHONG_REVOKE_URI = "/invoiceEx/zpy/electric/invoice/revokeRedInformation";

    /**自动开票-------登录接口*/
    public static final String INVOICE_API_LOGIN_SERVICE_ID = "DLYZ";
    public static final String INVOICE_API_LOGIN_URI = "/invoiceEx/zpy/electric/auth/validateLogon";

    /**自动开票-------上传验证码接口*/
    public static final String INVOICE_API_UPLOAD_CODE_SERVICE_ID = "SCDXYZM";
    public static final String INVOICE_API_UPLOAD_CODE_URI = "/invoiceEx/zpy/electric/auth/uploadVerificationCode";





    //红冲确认
    public static final Integer RED_CHONG_CONFIRM = 1;

    //红冲拒绝
    public static final Integer RED_CHONG_REFUSE = 0;

    /**
     * 发票发送到邮箱，开票时发送
     * */
    public static final Integer SEND_INVOICE_TYPE_FIRST = 0;

    /**
     * 发票发送到邮箱，开票后再次发送
     * */
    public static final Integer SEND_INVOICE_TYPE_NEXT = 1;

    /**
     * 自动开票开关
     * */
    public static final Integer AUTO_INVOICE_SWITCH = 2009;

    /**
     * 自动开票-----申请开票后要重新登录code
     * */
    public static final Integer AUTO_INVOICE_RE_LOGIN_CODE = 070004;

    public static String getErrorMsg(Integer code,String msg){
        if (Objects.isNull(code)){
            return msg.split(":")[0];
        }
        switch (code){
            case 070004:
                return "请重新登录！由于开票系统账号登录失败";
            default:
                return msg.split(":")[0];
        }
    }


}
